<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Flexigrid CI model
 *
 * PHP version 5
 *
 * @category  CodeIgniter
 * @package   Flexigrid CI
 * @author    Frederico Carvalho
 * @copyright 2008 Eye View Design
 * @version   0.1
*/

class Ajax_model extends Model 
{
	/**
	* Instanciar o CI
	*/
	public function Ajax_model()
    {
        parent::Model();
		$this->CI =& get_instance();
    }
	
	public function get_countries() 
	{
		$querys['main_query'] = "SELECT id,iso,name,printable_name,iso3,numcode FROM country {SEARCH_STR}";
		$querys['count_query'] = "SELECT count(id) as record_count FROM country {SEARCH_STR}";
		//Build querys
		$build_querys = $this->CI->flexigrid->build_querys($querys,1);
		
		//Get contents
		$return['records'] = $this->db->query($build_querys['main_query']);
		//Get record count
		$get_record_count = $this->db->query($build_querys['count_query']);
		$row = $get_record_count->row();
		$return['record_count'] = $row->record_count;
	
		//Return all
		return $return;
	}
}
?>